<%@language=vbscript%>
<%
	Session("FormName")="F22"
	Session("VanBan")=""
%>
<!--#include file="..\CheckSession.inc"-->
<!--#include file="..\RootContent.inc"-->
<!--#include file=..\getFormName.inc-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="vi">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<!--#include file="..\jvGrid.inc"-->
<%	
	bNam=request("bNam")
	bComm=Request("bComm")
	' HienSX	
	sort=request("sort")
	if sort="" then sort="RevDate"
	Select case sort
		Case "Date":
			oSQL=" order by ngaytao,trichyeu"
			bImgDate="../Images/up.gif"
			bImgSubject=""
		Case "RevDate":
			oSQL=" order by ngaytao DESC,trichyeu DESC"
			bImgDate="../Images/down.gif"
			bImgSubject=""
		Case "Subject":
			oSQL=" order by Trichyeu,ngaytao"
			bImgDate=""
			bImgSubject="../Images/up.gif"
		Case "RevSubject":
			oSQL=" order by Trichyeu DESC,ngaytao DESC"
			bImgDate=""
			bImgSubject="../Images/down.gif"
		Case "Attach":
			oSQL=" order by attach"
			bImgDate=""
			bImgNum=""
			bImgSymbol=""
			bImgSubject=""		
		Case "RevAttach":
			oSQL=" order by attach DESC"
			bImgDate=""
			bImgNum=""
			bImgSymbol=""
			bImgSubject=""
	End Select

	if Request("bFlowok")="ok" then
		bIDFlow=Request("IDFlow")
		sSQL="Update workflow set Tam=0 where maworkflow like '"& bIDFlow &"'"
		Conn.Execute sSQL
	end if
	if Request("bFlowloaibo")="ok" then
		on error resume next
		Conn.BeginTrans				
		bIDFlow=Request("IDFlow")
		sSQL="Delete from workflow where maworkflow like '"& bIDFlow &"'"
		Conn.Execute sSQL
		sSQL="Delete from flownode where maworkflow like '"& bIDFlow &"'"
		Conn.Execute sSQL
		if Err.number=0 then
			Conn.CommitTrans
		else
			Conn.RollbackTrans
		end if
	end if
	
	Select case bComm
		case "delete"
			On Error Resume Next
			Conn.BeginTrans			
			'bSoghinhan=request("TxtSoghinhan")
			bID=request("bID")
			
			'KTQuyen
			if KTQuyen(bID) then
				sSQL="Delete from VTDuthao where IdDuthao like '"& modistring(bID) &"'"
				Conn.Execute sSQL
				bTentep=Request("TxtTentep")			
				Set File = Server.CreateObject("ActiveFile.File")
				File.Name=RootContent & "Upload\"& cstr(bNam) &"\duthao\TEXT\"& bID & ".VT"
				if File.Exists() then
					File.Delete()
				end if
				sSQL="Select * from vanban_Noidung where Mavanthu like '"& modistring(bID) &"' and Loaivanthu like '3'"
				set RecNoidung=server.CreateObject("ADODB.Recordset")
				RecNoidung.CursorType=3
				RecNoidung.CacheSize=5
				RecNoidung.Open sSQL,Conn
				Set File = Server.CreateObject("ActiveFile.File")
				do while not RecNoidung.EOF
					File.Name=RootContent & "Upload\"& cstr(bNam) &"\duthao\"& RecNoidung("Tentep")
					if File.Exists() then
						File.Delete()
					end if
					RecNoidung.MoveNext
					if Err.number<>0 then
						exit Do
					end if
				Loop		
				Set File=nothing	
				%><%=Err.Description%><%
				'Xoa bang vanban_noidung
				sSQL="Delete from vanban_Noidung where Mavanthu like '"& modistring(bID) &"' and Loaivanthu like '3'"
				Conn.Execute sSQL
				
				if Err.number=0 then
					Conn.CommitTrans				
					bTrangthai=1				
				else
					bTrangthai=0
					Conn.RollbackTrans
				end if
				'Ghi nhan Ai da login thanh cong
				bHoten=Session("bHoten")
				bNgaygio=cstr(Date()) &" "& cstr(Time())
				bChucnang="C&#7853;p nh&#7853;t V&#259;n th&#432; d&#7921; th&#7843;o"
				bIDTailieu=bSoghinhan
				bDongtac="Xo&#225;"
				sSQL="insert into loguser(Tennguoisudung,ngaygio,chucnangdung,dongtac,IDTailieu,Trangthai) Values('"& bHoten _
					&"','"& bNgaygio &"','"& bChucnang &"','"& bDongtac &"','"& bIDTailieu &"','"& bTrangthai &"')"
				Conn.Execute sSQL			
				sSQL="Select * from VTDuthao where nguoitao like '"& Session("bMaCB") &"'" & oSQL
			End if 'KTQuyen
		case "search"
			bTukhoa=Request("TxtTukhoa")
			bTungay=Request("TxtTungay")
			bDenngay=Request("TxtDenNgay")
			bTrichyeu=Request("TxtTrichyeu")
			'bSoghinhan=Request("TxtSogoc")
			if (bTungay<>"" and bDenNgay<>"") then
				sSQL="Select * from VTDuthao where nguoitao like '"& Session("bMaCB") &"'"				
				sSQL=sSQL+" And ( NgayTao Between '"& SaveDate(bTungay) &"' And '"& SaveDate(bDenngay) &"') "
				'sSQL=sSQL+" And soghinhan like '%"& modistring(bSoghinhan) &"%'"
				sSQL=sSQL+" And Tukhoa like '%"& modistring(bTukhoa) &"%'"
				sSQL=sSQL+" And trichyeu like '%"& modistring(btrichyeu) &"%' " & oSQL
			else
				if (trim(bTungay)="" and trim(bDenNgay)="") then
					sSQL="Select * from VTDuthao where nguoitao like '"& Session("bMaCB") &"'"		
					'sSQL=sSQL+" And soghinhan like '%"& modistring(bSoghinhan) &"%'"
					sSQL=sSQL+" And Tukhoa like '%"& modistring(bTukhoa) &"%' "
					sSQL=sSQL+" And trichyeu like '%"& modistring(btrichyeu) &"%'" & oSQL
				end if
			end if
		Case else
			sSQL="Select * from VTDuthao where nguoitao like '"& Session("bMaCB") &"'" & oSQL
	end select
	Set Rec=server.CreateObject("ADODB.Recordset")
	Rec.CursorType=3
	Rec.CacheSize=5
	
	Dim nRecCount	' Number of records found
	Dim nPageCount	' Number of pages of records we have
	Dim nPage	' Current page number
	nPage=CLng(request("Page"))	
	if nPage="" then nPage=1
	rec.Open ssql,Conn
	if  rec.EOF and rec.BOF then
		nPageCount=0
	end if	
	
	'Rec.Open ssql,Conn	
	bDisplay=Request("bDisplay")
	if  bDisplay then
		sSQL="Select * from VTDuthao where IdDuthao like "& request("bID")
		Set RecDisplay=Server.CreateObject("ADODB.Recordset")
		RecDisplay.CursorType=3
		RecDisplay.CacheSize=5
		RecDisplay.Open sSQL,Conn
		if RecDisplay.RecordCount>0 then
			'bSoghinhan=RecDisplay("Soghinhan")
			bID=RecDisplay("IDDuthao")
			bNgayKy=RecDisplay("Ngaytao")
			bTukhoa=RecDisplay("Tukhoa")
			bTrichyeu=RecDisplay("TRichyeu")
			bTenTep=RecDisplay("Tentep")
		end if
		RecDisplay.Close
		set RecDisplay=nothing
	end if
%>	
<%	if request("chuachon")="thongtin" then%>
		<p align=center><font face='Arial' color=red>B&#7841;n c&#7847;n ch&#7885;n &#273;&#250;ng th&#244;ng tin c&#7847;n s&#7917;a</font></p>
<%	end if
%>
<!--#include file="..\jvfunction.inc"-->
<script language=VBScript runat=server>
	' H&#224;m &#273;&#7883;nh d&#7841;ng l&#7841;i ng&#224;y M/D/Y-> D/M/Y
	Function FormatDate(vDate)
	   If Not IsNull(vDate) Then
	        vM = Right("0" & Month(vDate), 2)
	        vD = Right("0" & Day(vDate), 2)
	        vY = Right("19" & Year(vDate), 4)
	        FormatDate = vD & "/" & vM & "/" & vY
	   End If
	End Function
	Function ModiString(mess_s)
		message = Replace("" & mess_s,"'", "''")
		ModiString=message
	End function
	Function SaveDate(vDate)
		dim bvitri1
		dim bvitri2
	   vDate=trim(cstr(vDate))
	   bvitri1=instr(1,vDate,"/")
	   bMonth=left(vDate,bvitri1-1)
	   bvitri2=instr(bvitri1+1,vDate,"/")
	   Dim Temp
	   Temp=right(vDate,len(vDate)-bvitri1)
	   bDay=left(Temp,bvitri2-bvitri1-1)
	   bYear=right(vDate,len(vDate)-bvitri2)
       SaveDate=bDay+"/"+bMonth+"/"+bYear
	End Function	
	Function KTQuyen(bID)
			KTQuyen=false
			sSQL="Select IDDuthao from VTDuthao where IDDuthao='"& bID &"' and nguoitao = '"& Session("bMaCB") &"'"
			Set RecKTQ=server.createobject("adodb.recordset")
			RecKTQ.cursortype=3
			RecKTQ.cachesize=5
			RecKTQ.open sSQL,Conn
			if RecKTQ.recordcount then
				KTQuyen=true
			end if
			RecKTQ.close
			set RecKTQ=nothing
	End Function
</script>	
<title>New Page 1</title>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
//HienSX
function Sort(SortKey){
	if (document.Noidung.Sort.value.indexOf(SortKey)== -1)
		document.Noidung.Sort.value=SortKey;
	else {
		if (document.Noidung.Sort.value.indexOf('Rev')== -1)
			document.Noidung.Sort.value='Rev' + SortKey;
		else
			document.Noidung.Sort.value= SortKey;
	}
	Noidung.target="right"
	Noidung.action="frmdsVTDuthao.asp?sort=" + Noidung.Sort.value;
	Noidung.submit();
}

function SetFocus(){
	window.Noidung.CmdSearch.focus();	
}

function CmdAdd_onclick() {
	window.Noidung.target="right"
	window.Noidung.action="frmVTDuthao.asp?bComm=add&sort="+Noidung.Sort.value;
	window.Noidung.submit();
}

function CmdEdit_onclick() {
	if (Noidung.bID.value==""){
		alert("Cho biết thông tin cần sửa");
		return false;
	}
	Noidung.TxtTrichyeu.disabled=false		
	Noidung.TxtTrichyeu.disabled=false
	Noidung.TxtTuKhoa.disabled=false
	window.Noidung.target="right"
	window.Noidung.action="frmVTDuthao.asp?bComm=edit";
	window.Noidung.submit();
}

function CmdSearch_onclick() {
	if (Noidung.TxtTungay.disabled){
		<%if Request("bfromflow")<>"ok" then%>
			Noidung.CmdDelete.disabled=true;
			Noidung.CmdEdit.disabled=true;
			Noidung.CmdEmail.disabled=true;
		<%end if%>
		Noidung.CmdSearch.value="Tì<u>m</u>";
		
		//Noidung.TxtSogoc.disabled=false;
		Noidung.TxtDenngay.disabled=false;
		Noidung.TxtTuKhoa.disabled=false;
		Noidung.TxtTungay.disabled=false;
		Noidung.TxtTrichyeu.disabled=false;
		//Noidung.TxtSogoc.value="";
		//Noidung.TxtDenngay.value="<%=Formatdate(Date())%>";
		Noidung.TxtDenngay.value="";
		Noidung.TxtTuKhoa.value="";
		//Noidung.TxtTungay.value="<%=Formatdate(Date()-90)%>";
		Noidung.TxtTungay.value="";
		Noidung.TxtTrichyeu.value="";
		Noidung.TxtTungay.focus();
		return false;
	}
	if(trim(Noidung.TxtTungay.value)!=""){
		if (!isDate(trim(Noidung.TxtTungay.value))){
			alert("Ngày không hợp lệ");
			Noidung.TxtTungay.focus();
			return false;
		}
		else
			if(trim(Noidung.TxtDenngay.value)==""){
				alert("Cho biết đến ngày");
				Noidung.TxtDenngay.focus();
				return false;
			}
	}
	if(trim(Noidung.TxtDenngay.value)!=""){	
		if (!isDate(trim(Noidung.TxtDenngay.value))){
			alert("Ngày không hợp lệ");
			Noidung.TxtDenngay.focus();
			return false;
		}
		else
			if(trim(Noidung.TxtTungay.value)==""){
				alert("Cho biết từ ngày");
				Noidung.TxtDenngay.focus();
				return false;
			}
	}
	window.Noidung.target="right"
	<%if Request("bfromflow")="ok" then%>
		window.Noidung.action="frmdsvtduthao.asp?bfromflow=ok&bComm=search";
	<%else%>
		window.Noidung.action="frmdsvtduthao.asp?bComm=search";
	<%end if%>
	window.Noidung.submit();
}
function Row_Click(Sogoc,Tukhoa,Tungay,Trichyeu,Tentep,soghinhan){
	//document.Noidung.TxtSogoc.value=Sogoc;
	document.Noidung.TxtTuKhoa.value=Tukhoa;
	document.Noidung.TxtTungay.value=Tungay;
	document.Noidung.TxtDenngay.value=Tungay;
	document.Noidung.TxtTrichyeu.value=Trichyeu;
	document.Noidung.TxtTentep.value=Tentep;
//	document.Noidung.TxtSoghinhan.value=soghinhan;
}
function CmdNoidung_onclick() {
	if (Noidung.bID.value!=""){
		window.Noidung.target="new";
		<%if Request("bfromflow")="ok" then%>
			window.Noidung.action="xemnoidung.asp?bfromflow=ok&LoaiVt=3&bMa="+"<%=request("bID")%>";
		<%else%>
			//window.Noidung.action="xemnoidung.asp?Loaivt=duthao&Tentep="+document.Noidung.TxtTentep.value;
			window.Noidung.action="xemnoidung.asp?LoaiVt=3&bMa="+"<%=request("bID")%>";
		<%end if%>
		window.Noidung.submit();
	}
	else{
		alert("H&#227;y ch&#7885;n V&#259;n th&#432; c&#7847;n xem");
	}
	
	
}
function CmdDelete_onclick() {	
	if (trim(Noidung.bID.value)!=""){
		if(!confirm("Bạn có muốn xoá không ?")){
			return false;	
		}
		window.Noidung.target="right"
		window.Noidung.action="frmdsvtduthao.asp?page="+"<%=nPage%>"+"&bComm=delete"+"&bNam="+"<%=bNam%>";
		window.Noidung.submit();
	}
	else{
		alert("Hãy chọn thông tin cần xoá");
	}
}
function CmdNoidungtep_onclick() {
	if(Noidung.bID.value==""){
		alert("Cho biết văng thư");
		return false;
	}
	window.Noidung.target="right"
	window.Noidung.action="upload.asp?LoaiVt=duthao&filename="+Noidung.TxtTentep.value;
	window.Noidung.submit();
}

function CmdWorkflow_onclick() {
	if (Noidung.bID.value==""){
		alert("Bạn hãy chọn văn thư cần xử lý");
		return false;
	}
	if(!confirm("Bạn có thực sự tạo luồng xử lý không ?")){
	  return false;
	}
	window.Noidung.target="right";	
	window.Noidung.action="../workflow/createworkflow.asp?bComm=vtduthao";
	window.Noidung.submit();	
}

function CmdBack_onclick() {
	Noidung.target="right";
	Noidung.action="../workflow/frmdsflow.asp";
	Noidung.submit();
}
function CmdEmail_onclick() {
	Noidung.target="_blank";
	Noidung.TxtTrichyeu.disabled=false;
	Noidung.action="compose.asp?bLoaiVt=3&bMa="+"<%=bID%>"+"&bNam="+"<%=bNam%>";
	Noidung.submit();
}

function TxtTungay_onkeyup(str){
var keycode
keycode=window.event.keyCode
if (isEdit(keycode,str)){
	Noidung.TxtTungay.value=editdate(trim(str))
	}
}

function TxtDenngay_onkeyup(str){
var keycode
keycode=window.event.keyCode
if (isEdit(keycode,str)){
	Noidung.TxtDenngay.value=editdate(trim(str))
}
}
//-->
</SCRIPT>
</head>
<LINK href="../styles/styles.css" type=text/css rel=STYLESHEET>
<body bgcolor=#F8F9D9 leftmargin=2 topmargin=0 onload="SetFocus()">
<form name="Noidung" method="post">
<Input TYPE="hidden" name="Sort" value="<%=sort%>">
  <table border="0" width="100%" bgcolor="#BDD5D0" style="Font-family:Times New Roman;font-size:11pt;BORDER-BOTTOM-STYLE: none; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0">
	<%if bDisplay then%>
		<Input type=hidden name=TxtTentep value='<%=bTentep%>'>
		<!-- <Input type=hidden name=TxtSoghinhan value='<%=bSoghinhan%>'> -->
		<input name=bID type=hidden value='<%=bID%>'>
	<%else%>
		<Input type=hidden name=TxtTentep>
		<!-- <Input type=hidden name=TxtSoghinhan> -->
		<input name=bID type=hidden >
	<%end if%>
    <tr>
      <TD WIDTH="100%" COLSPAN="6" BGCOLOR="#000080"><P ALIGN="CENTER"><FONT FACE="times new roman" COLOR="#FFFFFF" SIZE=2>V&#258;N B&#7842;N CÁ NHÂN</FONT></P></TD>
    </tr>
	<!-- bg thphuc 19-02-2003 -->
	<!--     <tr>
      <td width="15%" align="center">S&#7889; &#208;K</td>
      <td width="25%">
		<%if bID then%>
			<input type="text" name="TxtSogoc" value='<%=bSoghinhan%>' Disabled=true style="width:100%" size="20"></td>
		<%else%>
			<input type="text" name="TxtSogoc" Disabled=true style="width:100%"></td>
		<%end if%>
      <td width="15%"><p  align=center>T&#7915; ng&#224;y <BR>(Ng&#224;y t&#7841;o)</p></td>
      <td width="15%">
		<%if bDisplay then%>
			<input type='text' name='TxtTungay' value='<%=FormatDate(bNgayky)%>' Disabled=true  maxlength=10 LANGUAGE=javascript onkeyup="return TxtTungay_onkeyup(this.value)" style="width:100%" size="20"></td>
		<%else%>
			<input type="text" name="TxtTungay"  maxlength=10 Disabled=true LANGUAGE=javascript onkeyup="return TxtTungay_onkeyup(this.value)" style="width:100%"></td>
		<%end if%>
      <td width="15%"><p  align=center>&#208;&#7871;n ng&#224;y<BR>(Ng&#224;y T&#7841;o)</p></td>
      <td width="15%">
		<%if bDisplay then%>
			<input type="text" name="TxtDenngay" value='<%=FormatDate(bNgayky)%>' Disabled=true  maxlength=10 LANGUAGE=javascript onkeyup="return TxtDenngay_onkeyup(this.value)" style="width:100%" size="20"></td>
		<%else%>
			<input type="text" name="TxtDenngay" Disabled=true  maxlength=10 LANGUAGE=javascript onkeyup="return TxtDenngay_onkeyup(this.value)" style="width:100%"></td>
		<%end if%>
      </tr> -->
	  
      <tr>
		<td width="15%"><p  align=center>T&#7915; ng&#224;y </p></td>
      <td width="15%">
		<%if bDisplay then%>
			<input type='text' name='TxtTungay' value='<%=FormatDate(bNgayky)%>' Disabled=true  maxlength=10 LANGUAGE=javascript onkeyup="return TxtTungay_onkeyup(this.value)" style="width:100%" size="20"></td>
		<%else%>
			<input type="text" name="TxtTungay"  maxlength=10 Disabled=true LANGUAGE=javascript onkeyup="return TxtTungay_onkeyup(this.value)" style="width:100%"></td>
		<%end if%>
		<td width="15%"><p  align=center>&#208;&#7871;n ng&#224;y</p></td>
      <td width="15%">
		<%if bDisplay then%>
			<input type="text" name="TxtDenngay" value='<%=FormatDate(bNgayky)%>' Disabled=true  maxlength=10 LANGUAGE=javascript onkeyup="return TxtDenngay_onkeyup(this.value)" style="width:100%" size="20"></td>
		<%else%>
			<input type="text" name="TxtDenngay" Disabled=true  maxlength=10 LANGUAGE=javascript onkeyup="return TxtDenngay_onkeyup(this.value)" style="width:100%"></td>
		<%end if%>
        <td width="10%" align=center>T&#7915; kho&#225;</td>
        <td width="30%">
        <%if bDisplay then%>
			<input type="text" name="TxtTuKhoa" value='<%=bTukhoa%>' Disabled=true style="width:100%" size="20"></td>
		<%else%>
			<input type="text" name="TxtTuKhoa" Disabled=true style="width:100%"></td>
		<%end if%>
		</tr>
		<tr>
        <td width="15%" align="center">Tr&#237;ch y&#7871;u</td>
        <td width="85%" colspan=5>
        <%if bDisplay then%>
			<input type="text" name="TxtTrichyeu" value='<%=bTrichyeu%>' Disabled=true style="width:100%" size="20"></td>
		<%else%>
			<input type="text" name="TxtTrichyeu" Disabled=true style="width:100%"></td>
		<%end if%>
      </tr>
	  <!-- ed thphuc 19-02-2003 -->
    </center>
  </table>
<!-- Buttons -->
  <%if  request("bfromflow")="ok" then%>
	<!-- bg thphuc 19-02-2003 -->
	<table border="0" width="100%" bgcolor="#BDD5D0" style="Font-family:Times New Roman;font-size:11pt;BORDER-BOTTOM-STYLE: none; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0">
	<!-- ed thphuc 19-02-2003 -->
        <tbody>
          <tr>            
            <td width="34%">
              <%if bDisplay then%>
					<%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)="1" or Session("IsAdmin") then%>
						<Button language="javascript"  name="CmdWorkflow" onclick="return CmdWorkflow_onclick()" style=" height: 23; position: relative; width: 100%;font-family:Arial" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button>
					<%else%>
						<Button language="javascript"  disabled name="CmdWorkflow" onclick="return CmdWorkflow_onclick()" style=" height: 23; position: relative; width: 100%;font-family:Arial" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button>
					<%end if%>
              <%else%>
				<Button language="javascript" disabled name="CmdWorkflow" onclick="return CmdWorkflow_onclick()" style="height: 23; position: relative; width: 100%;font-family:Arial" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button>
			<%end if%>
            </td>
            <td width="34%"><Button language="javascript" name="CmdSearch" onclick="return CmdSearch_onclick()" style=" height: 23; position: relative; width:100%;font-family:Arial" accesskey="M"><p>Tì<u>m</u> kiếm</p></Button></td>
            <td width="33%"><Button name="CmdBack" style=" height: 23; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdBack_onclick()" accesskey="Y"><p>Qua<u>y</u> lại</p></Button></td>
          </tr>
        </tbody>
      </table>
  <%else%>
	<!-- bg thphuc 19-02-2003 -->
	<table border="0" width="100%" bgcolor="#BDD5D0" style="Font-family:Times New Roman;font-size:11pt;BORDER-BOTTOM-STYLE: none; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0">
	<!-- ed thphuc 19-02-2003 -->
  		<tr>
	    <td width="15%">
   		   	<Button name="CmdAdd" style=" height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdAdd_onclick()" accesskey="T"><u>T</u>hêm</Button>
		   
	    </td>
   		 <td width="15%">
	      	<%if bDisplay then%>
				<Button name="CmdEdit" style=" height: 25; position: relative; width: 100%;font-family:Arial"  LANGUAGE=javascript onclick="return CmdEdit_onclick()" accesskey="S"><u>S</u>ửa</Button>
			<%else%>
				<Button disabled name="CmdEdit" style=" height: 25; position: relative; width: 100%;font-family:Arial"  LANGUAGE=javascript onclick="return CmdEdit_onclick()" accesskey="S"><u>S</u>ửa</Button>
			<%end if%>
		 </td>
   		 <td width="15%" >
   			<%if bDisplay then%>
   		  		<Button name="CmdDelete" style="height: 25; position: relative; width: 100%;font-family:Arial"  LANGUAGE=javascript onclick="return CmdDelete_onclick()" accesskey="X"><u>X</u>óa</Button>
   		  	<%else%>
   		  		<Button disabled name="CmdDelete" style=" height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdDelete_onclick()" accesskey="X"><u>X</u>óa</Button>
   		  	<%end if%>
   		  </td>	    
	   	 <td width="20%">
	   		<%if bDisplay then%>
				<%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)="1" or Session("IsAdmin") then%>
					<Button name="CmdWorkflow" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdWorkflow_onclick()" accesskey="a"><p>T<u>ạ</u>o luồng xử lý</p></Button>
				<%else%>
					<Button disabled name="CmdWorkflow" style="height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdWorkflow_onclick()" accesskey="a"><p>T<u>ạ</u>o luồng xử lý</p></Button>
				<%end if%>
			<%else%>
				<Button disabled name="CmdWorkflow" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdWorkflow_onclick()" accesskey="a"><p>T<u>ạ</u>o luồng xử lý</p></Button>
			<%end if%>
   		 </td>
   		 <td width="20%">
			<Button name="CmdSearch" style="height: 25; position: relative; width:100%;font-family:Arial"  LANGUAGE=javascript onclick="return CmdSearch_onclick()" accesskey="M"><p>Tì<u>m</u> kiếm</p></Button>
   		 </td>
   		 <td width="15%" >
		<%if bDisplay then%>
			<Button name="CmdEmail" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdEmail_onclick()" accesskey="E"><u>E</u>mail</Button>
		<%else%>
			<Button disabled name="CmdEmail" style="height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdEmail_onclick()" accesskey="E"><u>E</u>mail</Button>
		<%END IF%>
   		 </td>
	  </tr>
	</table>
	<%end if%>
<!-- Danh sach van ban du thao -->
  <table border="0" width="100%" style="Border-color:#C0C0C0;BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid">
	<tr bgcolor="#BDD5D0">
	  <td width="5%"></td>
      <td width="1%" align="center"><A onmouseover="window.status='';return true" HREF="javascript:Sort('Attach')">&nbsp;<IMG border=0 SRC=../images/attach.gif>&nbsp;</A></td>	  	  
	  <!-- bg thphuc 19-02-2003 -->
      <!-- <td width="15%"><p align="center"><b>S&#7889; ghi nh&#7853;n</b></td> -->
	  <!-- ed thphuc 19-02-2003 -->
      <td width="20%" nowrap><A onmouseover="window.status='';return true" HREF="javascript:Sort('Date')">&nbsp;<b>Ngày tạo</b>&nbsp;&nbsp;&nbsp;
	  <% if bImgDate<>"" then %><IMG SRC="<%=bImgDate%>" BORDER=0><%end if%> </A></td>
      <td width="75%" nowrap><A onmouseover="window.status='';return true" HREF="javascript:Sort('Subject')">&nbsp;<b>Tr&#237;ch y&#7871;u</b>&nbsp;&nbsp;&nbsp;
	  <% if bImgSubject<>"" then %><IMG SRC="<%=bImgSubject%>" BORDER=0><%end if%>
	  </A></td>
	 </tr>
   <% 
	cnt=0
	If Not Rec.Eof Then
		nRecCount = Rec.RecordCount
		Rec.PageSize =20
		nPageCount = Rec.PageCount
		If nPage < 1 then
			nPage = 1			
		End If
		if nPage > nPageCount Then
			nPage=nPageCount
		end if
		cnt=(pg-1)*pgsize + 1		    
		STT=1
		rec.AbsolutePage=nPage
		howmanyrecs=0
	Do while not Rec.EOF and howmanyrecs<rec.PageSize
		if (cnt/2=int(cnt/2)) then
				color="#eeeecc"
			else
				color="#F8F9D9"
			end if

			if rec("attach") then
				imagesAttach="<IMG border=0 SRC=../images/attach.gif>"
			else				
				imagesAttach=""
			end if
			
%>
		<%if cstr(Rec("IdDuthao"))=Request("bID") then
			color="#BDD7D6"
		end if%>
      <tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>"  onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
		<%if Request("bfromflow")="ok" then%>			
			<td width="5%"><a href="xemnoidung.asp?LoaiVt=3&bMa=<%=Rec("IdDuthao")%>&bNam=<%=year(Rec("Ngaytao"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thuthuong.gif></p></a></td>
			<td width="1%"><a href="xemnoidung.asp?LoaiVt=3&bMa=<%=Rec("IdDuthao")%>&bNam=<%=year(Rec("Ngaytao"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><%=imagesAttach%></p></a></td>
			
			<!-- bg thphuc 19-02-2003 -->
			<!-- <td width="15%" ><a style='cursor:hand;color:blue;text-decoration: none' href="frmdsVTDuthao.asp?Page=<%=nPage%>&bfromflow=ok&bDisplay=True&bID=<%=Rec("IdDuthao")%>&bNam=<%=year(Rec("Ngaytao"))%>"><p align="left"><%=Rec("soghinhan")%></p></a></td> -->
			<!-- ed thphuc 19-02-2003 -->
			<td width="20%"><a style='cursor:hand;color:blue;text-decoration: none' href="frmdsVTDuthao.asp?sort=<%=sort%>&Page=<%=nPage%>&bfromflow=ok&bDisplay=True&bID=<%=Rec("IdDuthao")%>&bNam=<%=year(Rec("Ngaytao"))%>"><p align="center"><%=FormatDate(Rec("ngaytao"))%></p></a></td>
			<td width="75%"><a style='cursor:hand;color:blue;text-decoration: none' href="frmdsVTDuthao.asp?sort=<%=sort%>&Page=<%=nPage%>&bfromflow=ok&bDisplay=True&bID=<%=Rec("IdDuthao")%>&bNam=<%=year(Rec("Ngaytao"))%>"><p align="left"><%=Rec("trichyeu")%></p></a></td>
		<%else%>
			<td width="5%" ><a href="xemnoidung.asp?LoaiVt=3&bMa=<%=Rec("IdDuthao")%>&bNam=<%=year(Rec("Ngaytao"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thuthuong.gif></p></a></td>			
			<td width="1%"><a href="xemnoidung.asp?LoaiVt=3&bMa=<%=Rec("IdDuthao")%>&bNam=<%=year(Rec("Ngaytao"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><%=imagesAttach%></p></a></td>			
			
			<!-- bg thphuc 19-02-2003 -->
			<!-- <td width="15%" ><a style='cursor:hand;color:blue;text-decoration: none' href="frmdsVTDuthao.asp?Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("IdDuthao")%>&bNam=<%=year(Rec("Ngaytao"))%>"><p align="left"><%=Rec("soghinhan")%></p></a></td> -->
			<!-- ed thphuc 19-02-2003 -->
			<td width="20%"><a style='cursor:hand;color:blue;text-decoration: none' href="frmdsVTDuthao.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("IdDuthao")%>&bNam=<%=year(Rec("Ngaytao"))%>"><p align="center"><%=FormatDate(Rec("Ngaytao"))%></p></a></td>
			<td width="75%"><a style='cursor:hand;color:blue;text-decoration: none' href="frmdsVTDuthao.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("IdDuthao")%>&bNam=<%=year(Rec("Ngaytao"))%>"><p align="left"><%=Rec("trichyeu")%></p></a></td>
		<%end if%>
      </tr>
		<%
			if  Session("VanBan")="" then
				Session("VanBan")="-"& Rec("IdDuthao")
			else
				Session("VanBan")=Session("VanBan") & "-" & Rec("IdDuthao")
			end if
		%>
<%		STT=STT+1
		Rec.MoveNext
		cnt=cnt+1
		howmanyrecs=howmanyrecs+1
	loop
		Session("VanBan")=Session("VanBan") & "-"
	End if
	rec.Close
	set rec=nothing
%>
    </table>
</form>
<%
Response.Write "<font face='Arial'>" 
response.write "<Table width='100%'>"
response.write "<TR>"
response.write "<TD width='15%'>"
response.write "<p align=left>Trang:  " & cstr(nPage) & "/" & cstr(nPageCount)
response.write "</TD>"
response.write "<TD>"
response.write "<p align=center>"
for counter=1 to nPageCount
	if Request("bfromflow")="ok" then
		if bComm<>"search"  then
			txt="&nbsp;<a href='frmdsvtduthao.asp?bfromflow=ok&page="+ cstr(counter)+ "&bComm='>" & counter & "</a>&nbsp;"
		else
			txt="&nbsp;<a href='frmdsvtduthao.asp?bfromflow=ok&page="+ cstr(counter)+ "&bComm=search&TxtTungay="+bTungay+"&TxtDenngay="+bdenngay+"&TxtTukhoa="+bTukhoa+"&TxtTrichyeu="+bTrichyeu+"'>" & counter & "</a>&nbsp;"
		end if
	else
		if bComm<>"search"  then
			txt="&nbsp;<a href='frmdsvtduthao.asp?page="+ cstr(counter)+ "&bComm='>" & counter & "</a>&nbsp;"
		else
			txt="&nbsp;<a href='frmdsvtduthao.asp?page="+ cstr(counter)+ "&bComm=search&TxtTungay="+bTungay+"&TxtDenngay="+bdenngay+"&TxtTukhoa="+bTukhoa+"&TxtTrichyeu="+bTrichyeu+"'>" & counter & "</a>&nbsp;"
		end if
	end if
	response.write(txt)
next
Response.Write "</font>" 
response.write "</TD>"
response.write "</TR>"
response.write "</Table>"
%>   
</body>
<%
	Conn.Close
	Set Conn=nothing
%>